<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>ListPlan</title>
<link rel="stylesheet" type="text/css" href="../css/blueprint/screen.css" media="screen, projection"/>
<link rel="stylesheet" type="text/css" href="../css/blueprint/plugins/buttons/screen.css" media="screen, projection"/>
<link type="text/css" href="../css/redmond/jquery-ui-1.7.custom.css" rel="stylesheet" />
<script type="text/javascript" src="../script/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="../script/jquery-ui-1.7.custom.min.js"></script>
<script type="text/javascript" src="../script/jquery.plugin.tablecross-0.1.js"></script>
<script type="text/javascript" src="../script/jquery.plugin.ajaxtip-0.1.js"></script>
<script type="text/javascript">
	var queryVO = {};
    $(document).ready(function() {
    	$("#planDataTable").ajaxProccessTip();
    	getPlanData(queryVO, 1, 10);
    });
    function getPlanData(queryVO, pageIndex, pageSize) {
    	$.ajax({
            type: "post",
            url: "ListOwnPlan.action",
            data: {"pageVO.pageIndex": pageIndex, "pageVO.pageSize": pageSize},
            dataType: "json",
            success: function(data) {
                if (data.main == null) {
                	var strArr = new Array();
                	strArr.push('<tr>');
                	strArr.push('<td colspan="8" align="center">还没有方案，请先编辑提交方案<a href="SubmitPlan.html" target="MainFrame" class="button"><img src="../css/blueprint/plugins/buttons/icons/page_add.png" alt=""/>提交方案</a></td>');
                	strArr.push('</tr>');
                    $("#planDataBody").html(strArr.join(''));
                } else {
                	var strArr = new Array();
                    strArr.push('<tr>');
                    strArr.push('<td>' + data.main.registerid + '</td>');//项目登记号
                    strArr.push('<td>' + data.main.prjUnit + '</td>');//项目单位
                    strArr.push('<td>' + data.main.prjName + '</td>');//项目名称
                    strArr.push('<td>' + data.main.prjXmxzName + '</td>');//项目性质
                    strArr.push('<td>' + data.main.prjXmgm + '</td>');//项目规模
                    strArr.push('<td>' + data.main.prjKzName + '</td>');//矿种
                    strArr.push('<td>' + data.main.prjKcfsName + '</td>');//开采方式
                    strArr.push('<td>' + data.main.prjScztName + '</td>');//审查状态
                    strArr.push('<td>' + '<a href="OwnPlanDetailPre.action?planId=' + data.main.prjPkid + '" target="MainFrame" class="button"><img src="../css/blueprint/plugins/buttons/icons/table.png" alt=""/>明细</a>');
                    if (data.main.prjFaztcode == "1") {
                        strArr.push('<a href="ModifyPlan.html" target="MainFrame" class="button"><img src="../css/blueprint/plugins/buttons/icons/page_edit.png" alt=""/>修改</a><button id="submit_button" type="button"><img src="../css/blueprint/plugins/buttons/icons/page_edit.png" alt=""/>提交</button>');//操作
                    }
                    strArr.push('</td>');
                    strArr.push('</tr>');
                    $("#planDataBody").html(strArr.join(''));
                    $("#planDataBody").tablecross('', 'odd', 'over');
                    submit();
                }
            }
    	});
    }
    function submit() {
        $("#submit_button").click(function() {
            $.ajax({
                type: "post",
                url:  "SubmitOwnPlan.action",
                dataType: "json",
                success: function(data) {
                    if (data.returnCode == "success") {
                        alert("提交成功");
                        getPlanData(queryVO, 1, 10);
                    } else {
                        alert("提交失败");
                    }
                }
            });
        });
    }
</script>
<style type="text/css">
tr.odd td {
    background: #ecf6fc;
}
</style>
</head>
<body>
<table id="planDataTable" style="margin-top: 0px" width="98%" align="center" cellpadding="2" cellspacing="2">
    <thead>
        <tr>
            <th width="10%">项目登记号</th>
            <th width="12%">项目单位</th>
            <th width="12%">项目名称</th>
            <th width="10%">项目性质</th>
            <th width="10%">项目规模</th>
            <th width="8%">矿种</th>
            <th width="8%">开采方式</th>
            <th width="8%">审查状态</th>
            <th>操作</th>
        </tr>
    </thead>
    <tbody id="planDataBody">
    </tbody>
</table>
</body>
</html>